namespace Microsoft.Robotics.Tracing
{
    using System.Diagnostics;
    using System.Reflection;

    /// <summary>
    /// MS Robotics tracing context factory. Contains some top level trace contexts shared by all baker components, as well as
    /// provides a few helper methods for generating new contexts
    /// Currently, we have a top level category for each top level folder under Full solution
    /// </summary>
    public class TraceContexts
    {   
        /// <summary>
        /// Shared Common trace context
        /// </summary>
        private static TraceContext common = new TraceContext("COMMON", null); 

        /// <summary>
        /// Shared computer vision trace context
        /// </summary>
        private static TraceContext vision = new TraceContext("VISION", null);

        /// <summary>
        /// Shared hardware platform platform trace context
        /// </summary>
        private static TraceContext hw = new TraceContext("HW", null);

        /// <summary>
        /// Shared Human Interaction trace context
        /// </summary>
        private static TraceContext hri = new TraceContext("HRI", null);

        /// <summary>
        /// Shared Manipulation trace context
        /// </summary>
        private static TraceContext manip = new TraceContext("MANIP", null);

        /// <summary>
        /// Shared Navigation trace context
        /// </summary>
        private static TraceContext nav = new TraceContext("NAV", null);

        /// <summary>
        /// Shared Test trace context
        /// </summary>
        private static TraceContext test = new TraceContext("TEST", null);

        /// <summary>
        /// Gets top level tracing context for common components 
        /// </summary>
        public static TraceContext Common 
        { 
            get 
            {
                return common; 
            } 
        }

        /// <summary>
        /// Gets top level tracing context for vision components 
        /// </summary>
        public static TraceContext Vision
        {
            get
            {
                return vision;
            }
        }

        /// <summary>
        /// Gets top level tracing context for hardware components 
        /// </summary>
        public static TraceContext HW
        {
            get
            {
                return hw;
            }
        }

        /// <summary>
        /// Gets top level tracing context for human interaction components 
        /// </summary>
        public static TraceContext HRI
        {
            get
            {
                return hri;
            }
        }

        /// <summary>
        /// Gets top level tracing context for Navigation components
        /// </summary>
        public static TraceContext Nav
        {
            get
            {
                return nav;
            }
        }

        /// <summary>
        /// Gets top level tracing context for Manipulation components
        /// </summary>
        public static TraceContext Manip
        {
            get
            {
                return manip;
            }
        }

        /// <summary>
        /// Gets top level tracing context for test components
        /// </summary>
        public static TraceContext Test
        {
            get
            {
                return test;
            }
        }

        /// <summary>
        /// Generates new tracing context from a custom string
        /// </summary>
        /// <param name="parent">Parent context. Not an optional parameter to enforce one of several roots</param>
        /// <param name="text">Custom context text</param>
        /// <returns>New context from custom string</returns>
        public static TraceContext FromString(TraceContext parent, string text) 
        {
            return new TraceContext(text, parent); 
        }
    }
}
